Fix/eid wallet barcode scanner deadlock#978
Conversation
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (2)
📒 Files selected for processing (2)
📝 WalkthroughWalkthroughTauri API dependency is upgraded to ChangesQR Scan Concurrency and Stale Session Management
Estimated Code Review Effort🎯 2 (Simple) | ⏱️ ~12 minutes Poem
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Description of change
Fixes a hard crash on iOS where the app froze and was killed by the watchdog (
0x8BADF00D— "failed to terminate gracefully") whenever the barcode scanner was active — most reliably on pressing back out of the Scan QR screen.Root cause was a re-entrancy deadlock in Tauri 2.10.3's mobile IPC:
plugin_command_response_handlerheld thePENDING_PLUGIN_CALLSmutex across the handler callback (theMutexGuardlived for the wholeif let Some(handler) = …lock()…remove() { handler() }block). When the barcode scanner'scancel()rejected the still-pendingscan(), that re-entered the same handler on the main thread and deadlocked the lock against itself. Tauri 2.11.2 fixes this by removing the handler into aletbinding so the lock is released before the handler runs.Changes:
tauri2.10.3 → 2.11.2 (andtauri-build/runtime/macros), plus@tauri-apps/api→^2.11.0. This is the actual fix.scanLogic.ts): a module-scopedscanInFlightguard that survives page re-mounts, and acancel()before eachscan()to tear down any stale native session. Defensive, prevents overlapping scans.Note: the Scan QR page re-mount loop (repeated device re-registration) is a separate pre-existing issue and is not addressed here; it no longer crashes the app, but is worth a follow-up.
Issue Number
N/A
Type of change
How the change has been tested
.ipscrash reports confirming the deadlock intauri::plugin::mobile::run_command::plugin_command_response_handler→Mutex::lock, reached viaBarcodeScannerPlugin.cancel.tauri 2.11.2source.cargo build --target aarch64-apple-ioscompiles cleanly with all plugins on 2.11.2.svelte-checkpasses (0 errors) for thescanLogic.tschange.tauri ios dev: scanning and pressing back no longer hangs/crashes.Change checklist
Summary by CodeRabbit
Chores
Bug Fixes